/**
 * 自定义表格相关API
 */
import request from '@/utils/request';
export const serviceHead = '/system'; // 项目前缀

/**
* 获取表格列表
* @param params
* @returns {*}
*/
export function getTableTemplate (params) {
  return request({
    url: `${serviceHead}/tableTemplate`,
    method: 'get',
    params: params
  });
}

/**
* 新增表格
* @param params
* @returns {*}
*/
export function addTableTemplate (params) {
  return request({
    url: `${serviceHead}/tableTemplate`,
    method: 'post',
    data: params
  });
}

/**
* 修改表格
* @param params
* @returns {*}
*/
export function editTableTemplate (params) {
  return request({
    url: `${serviceHead}/tableTemplate`,
    method: 'put',
    data: params
  });
}

/**
* 删除表格模版
* @param params
* @returns {*}
*/
export function delTableTemplate (id) {
  return request({
    url: `${serviceHead}/tableTemplate/${id}`,
    method: 'delete'
  });
}

/**
* 获取表格列列表
* @param params
* @returns {*}
*/
export function getTableColumn (params) {
  return request({
    url: `${serviceHead}/custom/list`,
    method: 'get',
    params
  });
}

/**
* 新增列
* @param params
* @returns {*}
*/
export function addTableColumn (params) {
  return request({
    url: `${serviceHead}/custom`,
    method: 'post',
    data: params
  });
}

/**
* 批量新增列
* @param params
* @returns {*}
*/
export function addBatchTableColumns (params) {
  return request({
    url: `${serviceHead}/custom/addCustomColumnBatch`,
    method: 'post',
    data: params
  });
}

/**
* 修改列
* @param params
* @returns {*}
*/
export function editTableColumns (params) {
  return request({
    url: `${serviceHead}/custom`,
    method: 'put',
    data: params
  });
}

/**
* 批量修改列
* @param params
* @returns {*}
*/
export function editBatchTableColumns (params) {
  return request({
    url: `${serviceHead}/custom/updateCustomColumnBatch`,
    method: 'post',
    data: params
  });
}

/**
* 删除列
* @param params
* @returns {*}
*/
export function delTableColumn (id) {
  return request({
    url: `${serviceHead}/custom/${id}`,
    method: 'delete'
  });
}

/**
* 获取客户自定义表格列
* @param params
* @returns {*}
*/
export function getCustomColumns (params) {
  return request({
    url: `${serviceHead}/tableColumnTemplate/list`,
    method: 'get',
    params: params
  });
}

/**
* 修改客户自定义表格列
* @param params
* @returns {*}
*/
export function editCustomColumns (params) {
  return request({
    url: `${serviceHead}/tableColumnTemplate/updateTemplate`,
    method: 'post',
    data: params
  });
}